<!DOCTYPE HTML>
<html xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:ui="http://java.sun.com/jsf/facelets" 
      xmlns:p="http://primefaces.org/ui" 
      xmlns:item="http://java.sun.com/jsf/composite/components/item" 
      xmlns:sec="http://www.springframework.org/security/tags">
    <ui:composition template="../../templates/template.xhtml" >

        <ui:param name="selectedMenuIndex" value="items" />
        <ui:define name="metadata">
            <f:metadata>
                <f:viewParam name="id" value="#{itemBean.currentObject}" converter="#{itemConverter}"/>
            </f:metadata>
        </ui:define>

        <ui:define name="header-content">
            <section id="content-title">
                <h:outputText value="#{msgs['itemUpdatePage.content.title']}" styleClass="content-title"/>
            </section>
        </ui:define>
        <ui:define name="content">
            <div id="update-item">
                <h:form>
                    <h:messages globalOnly="true" errorClass="errors" infoClass="success" warnClass="warning"/>
                    <item:cmp-item-input backingBean="#{itemBean.currentObject}" regions="#{itemBean.regions}" 
                                         categories="#{itemBean.categories}" types="#{itemBean.types}" />

                    <h:panelGroup styleClass="add-item-submit" layout="block">
                        <h:commandButton action="#{itemBean.update}">
                            <f:ajax execute="@form" render="@form"/>
                        </h:commandButton>
                    </h:panelGroup>
                </h:form>
            </div>
        </ui:define>
    </ui:composition>
</html>